//
//  LogCell.m
//  StationManager
//
//  Created by 张佳强 on 18/5/12.
//  Copyright © 2018年 Helong. All rights reserved.
//

#import "LogCell.h"

@implementation LogCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor colorWithRed:239/255.0 green:239/255.0 blue:244/255.0 alpha:1.0];
        
        self.baseView = [[UIView alloc]init];
        self.baseView.backgroundColor = [UIColor whiteColor];
        self.baseView.layer.cornerRadius = 8;
        self.baseView.layer.borderWidth = 0.5;
        self.baseView.layer.borderColor = [[UIColor blackColor] CGColor];
        [self.contentView addSubview:self.baseView];
        
        [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@10);
            make.top.equalTo(@0);
            make.right.equalTo(@-10);
            make.bottom.equalTo(@0);
        }];
        
        _stationNumLabel = [[UILabel alloc] init];
        _stationNumLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_stationNumLabel];
        
        [_stationNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(@5);
            make.top.equalTo(@10);
            make.width.mas_equalTo((SCREEN_WIDTH-20)/3);
            make.height.mas_equalTo(20);
        }];
        
        _stationNameLabel = [[UILabel alloc] init];
        _stationNameLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_stationNameLabel];
        
        [_stationNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(_stationNumLabel.mas_right).offset(5);
            make.top.equalTo(@10);
            make.right.equalTo(@-5);
            make.height.mas_equalTo(20);
        }];
        
        _taskTypeLabel = [[UILabel alloc] init];
        _taskTypeLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_taskTypeLabel];
        
        [_taskTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(@5);
            make.top.equalTo(_stationNumLabel.mas_bottom);
            make.width.mas_equalTo((SCREEN_WIDTH-60)/3);
            make.height.mas_equalTo(20);
        }];
        
        _taskPersonLabel = [[UILabel alloc] init];
        _taskPersonLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_taskPersonLabel];
        
        [_taskPersonLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(_taskTypeLabel.mas_right).offset(5);
            make.top.equalTo(_stationNumLabel.mas_bottom);
            make.width.mas_equalTo((SCREEN_WIDTH-60)/3);
            make.height.mas_equalTo(20);
        }];
        
        _stationTypeLabel = [[UILabel alloc] init];
        _stationTypeLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_stationTypeLabel];
        
        [_stationTypeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(_taskPersonLabel.mas_right).offset(5);
            make.top.equalTo(_stationNumLabel.mas_bottom);
            make.right.equalTo(@-5);
            make.height.mas_equalTo(20);
        }];

        
        _reasonLabel = [[UILabel alloc] init];
        _reasonLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_reasonLabel];
        
        [_reasonLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(@5);
            make.top.equalTo(_taskTypeLabel.mas_bottom);
            make.right.equalTo(@-5);
            make.height.mas_equalTo(20);
        }];
        
        _taskDateLabel = [[UILabel alloc] init];
        _taskDateLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_taskDateLabel];
        
        [_taskDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(@5);
            make.top.equalTo(_reasonLabel.mas_bottom);
            make.width.mas_equalTo((SCREEN_WIDTH-35)/2);
            make.height.mas_equalTo(20);
        }];
        
        _maintainDateLabel = [[UILabel alloc] init];
        _maintainDateLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_maintainDateLabel];
        
        [_maintainDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(_taskDateLabel.mas_right).offset(5);
            make.top.equalTo(_reasonLabel.mas_bottom);
            make.width.mas_equalTo((SCREEN_WIDTH-35)/2);
            make.height.mas_equalTo(20);
        }];
        
        _maintainPersonLabel = [[UILabel alloc] init];
        _maintainPersonLabel.font = [UIFont systemFontOfSize:12];
        [self.baseView addSubview:_maintainPersonLabel];
        
        [_maintainPersonLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(@5);
            make.top.equalTo(_taskDateLabel.mas_bottom);
            make.width.mas_equalTo((SCREEN_WIDTH-35)*2/3);
            make.height.mas_equalTo(20);
        }];
        
        _checkLabel = [[UILabel alloc] init];
        _checkLabel.font = [UIFont systemFontOfSize:12];
        _checkLabel.textColor = [UIColor blueColor];
        _checkLabel.textAlignment = NSTextAlignmentRight;
        [self.baseView addSubview:_checkLabel];
        
        [_checkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.right.equalTo(@-5);
            make.top.equalTo(_taskDateLabel.mas_bottom);
            make.width.mas_equalTo((SCREEN_WIDTH-35)/3);
            make.height.mas_equalTo(20);
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
